{% extends "configurarFaseLayout.html" %}
{% block subbodyfase %}
<script>
	function enviar() {
		var valor;
		if (document.form.check.value != null && document.form.check.checked) {
			valor = document.form.check.value;
		} else {
			for (i = 0; i < document.form.check.length; i++) {
				if (document.form.check[i].checked) {
					valor = document.form.check[i].value;
				}
			}
		}
		if (valor == null) {
			alert("Favor seleccionar un item. ");
			return false;
		}
		document.form.check.value=valor;
		return true;
	}
	
</script>
<center><div class=titulorojo>AGREGAR ITEM A LINEA BASE</div>
<br>
<br>
	<form id="form" name="form" action="agregarItemLb" method="post" onSubmit="return enviar();">
		<table>
			<input type="hidden" name="filtro" value="{{ filtro }}">
			<input type="hidden" name="idfase" value="{{ idfase }}">
			<input type="hidden" name="idlineabase" value="{{ idlineabase }}">
		</table>
		<br>
		<table id="tabla" name="tabla" border=1 cellpadding=2
			cellspacing=1 width=70% align=center bgcolor=#E5E5E5>
			<tr>
				<th class=titulochico width='10%'>Numero de Item</th>
				<th class=titulochico width='20%'>Nombre</th>
				<th class=titulochico width='20%'>Costo</th>
				<th class=titulochico width='20%'>Estado</th>
				<th class=titulochico width='10%'>Marcar</th>
			</tr>
			{% for item in items : %}
			<tr>
				<td align=center>{{ item.numeroitem }}</td>
				<td align=center>{{ item.nombre }}</td>
				<td align=center>{{ item.costo }}</td>
				<td align=center>{{ item.estadoItem.nombre }}</td>
				<td align=center><input type="radio" name="check"
					value="{{ item.iditem }}"></td>
			</tr>
			{% endfor %}
		<br>
		</table>
		<table>
			<tr>
				<td></td>
				<td><input name="aceptar" value="Aceptar" type="submit"><input
					name="cancelar" value="Cancelar" type="button" onClick="location.href='modificarLineaBase?filtro={{ filtro }}&idfase={{ idfase }}&idlineabase={{ idlineabase }}'"></td>
			</tr>
		</table>
	</form>
</center>
{% endblock %}
